﻿// Decompiled with JetBrains decompiler
// Type: ThoughtWorks.QRCode.Geom.Axis
// Assembly: ThoughtWorks.QRCode, Version=1.0.4778.30637, Culture=neutral, PublicKeyToken=null
// MVID: 2CFC48F2-5A3C-423F-9022-029D4BB7C8B6
// Assembly location: 

using ThoughtWorks.QRCode.Codec.Reader;

namespace ThoughtWorks.QRCode.Geom
{
  public class Axis
  {
    internal int sin;
    internal int cos;
    internal int modulePitch;
    internal Point origin;

    public virtual Point Origin
    {
      set
      {
        this.origin = value;
      }
    }

    public virtual int ModulePitch
    {
      set
      {
        this.modulePitch = value;
      }
    }

    public Axis(int[] angle, int modulePitch)
    {
      this.sin = angle[0];
      this.cos = angle[1];
      this.modulePitch = modulePitch;
      this.origin = new Point();
    }

    public virtual Point translate(Point offset)
    {
      return this.translate(offset.X, offset.Y);
    }

    public virtual Point translate(Point origin, Point offset)
    {
      this.Origin = origin;
      return this.translate(offset.X, offset.Y);
    }

    public virtual Point translate(Point origin, int moveX, int moveY)
    {
      this.Origin = origin;
      return this.translate(moveX, moveY);
    }

    public virtual Point translate(Point origin, int modulePitch, int moveX, int moveY)
    {
      this.Origin = origin;
      this.modulePitch = modulePitch;
      return this.translate(moveX, moveY);
    }

    public virtual Point translate(int moveX, int moveY)
    {
      long num1 = (long) QRCodeImageReader.DECIMAL_POINT;
      Point point = new Point();
      int num2 = moveX == 0 ? 0 : this.modulePitch * moveX >> (int) num1;
      int num3 = moveY == 0 ? 0 : this.modulePitch * moveY >> (int) num1;
      point.translate(num2 * this.cos - num3 * this.sin >> (int) num1, num2 * this.sin + num3 * this.cos >> (int) num1);
      point.translate(this.origin.X, this.origin.Y);
      return point;
    }
  }
}
